import { queryFamilyContactList, updateFamilyContact } from '../services/api';
import { message } from 'antd';

export default {
  namespace: 'contact',

  state: {
  },

  effects: {
    *fetchContactList({ payload }, { call, put }) {
      const response = yield call(queryFamilyContactList, payload);
      yield put({
        type: 'show',
        payload: response,
      });
    },
    *updateContact({ payload }, { call }) {
      yield call(updateFamilyContact, payload);
      message.success('提交成功');
    },
  },

  reducers: {
    show(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
